<template>
    <div id="HousingSecurity">
        <div class="tab">
          <ul>
            <li
              v-for="(item, index) in tabArr"
              :class="{'select': nowIndex === index}"
              :key="index"
              @click="tabClick(index)"
            >
             <p>{{item}}</p>
              <span v-if="nowIndex === index" style="width: 64px;height: 6px;background: #007AFF;border-radius: 3px;display: inline-block;">
              </span>
            </li>
          </ul>
        </div>
        <div v-if="nowIndex===0" class="content" style="height:calc( 100vh - 50px)">
          <p style="text-align: center;font-weight: bold;margin-bottom: 10px">城乡居民自建房安全专项整治核查表</p>
           <div>
             <van-field
               readonly
               v-model="cityName[0]"
               placeholder="请输入所属省"
               label="所属省"
             />
             <van-field
               readonly
               v-model="cityName[1]"
               placeholder="请输入所属市"
               label="所属市"
             />
             <van-field
               readonly
               v-model="cityName[2]"
               placeholder="请输入所属区县"
               label="所属区县"
             />
             <van-field
               readonly
               v-model="cityName[3]"
               placeholder="请输入所属乡(镇、街道)"
               label="所属乡(镇、街道)"
             />
             <van-field
               readonly
               v-model="cityName[4]"
               placeholder="请输入所属村(社区)"
               label="所属村(社区)"
             />
             <van-field required readonly  :disabled="!isAdd" clickable name="picker" :value="formData.housetype | inUseName(selectData.FWLXArr)" label="房屋类型" placeholder="请选择"
                        @click="isAdd?selectData.showPickerFWLX = true:''" />
             <van-popup v-model="selectData.showPickerFWLX" position="bottom" get-container="#popup">
               <van-picker value-key="DICNAME" show-toolbar :columns="selectData.FWLXArr" @confirm="onConfirmFWLX"
                           @cancel="selectData.showPickerFWLX = false" />
             </van-popup>
             <div v-if="formData.housetype=='1'">
               <van-field
                 required
                 :disabled="!isAdd"
                 v-model="formData.cqrxm"
                 placeholder="产权人姓名"
                 label="产权人姓名"
               />
               <div>
                 <van-field
                 required
                 :disabled="!isAdd"
                  style="width: 80%"
                 v-model="formData.cqrzjhm"
                 placeholder="产权人身份证号"
                 label="产权人身份证号"
               />
                <span @click="onclickplice" class="btn-style1"> 证号核验</span>
               </div>

             </div>
             <div v-if="formData.housetype=='2'">
              <div>
               <van-field
                 required
                 :disabled="!isAdd"
                  style="width: 80%;"
                 v-model="formData.cqdwmc"
                 placeholder="产权单位名称"
                 label="产权单位名称"
               />
                 <span @click="NumberCheck" style="margin-top:-38px" class="btn-style1">
                   单位核验
                 </span>
              </div>

                 <van-field
                   required
                   :disabled="!isAdd"

                   v-model="formData.cqdwxydm"
                   placeholder="统一社会信用代码"
                   label="统一社会信用代码"
                 />


               <van-field
                 required
                 :disabled="!isAdd"
                 v-model="formData.cqdwfr"
                 placeholder="法人代表姓名"
                 label="法人代表姓名"
               />
               <van-field
                 :disabled="!isAdd"
                 required
                 v-model="formData.cqdwfrzjhm"
                 placeholder="法人代表身份证号"
                 label="法人代表身份证号"
               />
             </div>
             <van-field  :disabled="!isAdd" required readonly clickable name="picker"  :value="formData.fwyt | inUseName(selectData.FWYTArr)" label="房屋用途" placeholder="请选择"
                        @click="isAdd?selectData.showPickerFWYT = true:''" />
             <van-popup v-model="selectData.showPickerFWYT" position="bottom" get-container="#popup">
               <van-picker value-key="DICNAME" show-toolbar :columns="selectData.FWYTArr" @confirm="onConfirmFWYT"
                           @cancel="selectData.showPickerFWYT = false" />
             </van-popup>
             <div v-if="formData.fwyt=='6'">
               <van-field  :disabled="!isAdd" required readonly clickable name="picker"  :value="formData.sftszz | inUseName(selectData.columns)"  label="是否同时自住" placeholder="请选择"
                          @click="isAdd?selectData.showPickerIFTSZZ = true:''" />
               <van-popup v-model="selectData.showPickerIFTSZZ" position="bottom" get-container="#popup">
                 <van-picker value-key="DICNAME" show-toolbar :columns="selectData.columns" @confirm="onConfirmIFTSZZ"
                             @cancel="selectData.showPickerIFTSZZ = false" />
               </van-popup>
               <van-field  :disabled="!isAdd" required name="checkboxGroup" label="具体用途(多选)">
                 <template #input>
                   <van-checkbox-group  :disabled="!isAdd" @change="changeData1" v-model="formData.jtfwyt" direction="horizontal">
                     <van-checkbox style="margin-bottom: 10px" name="1" shape="square">餐饮饭店</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="2" shape="square">民宿宾馆</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="3" shape="square">批发零售</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="4" shape="square">休闲娱乐</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="5" shape="square">教育培训</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="6" shape="square">医疗卫生</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="7" shape="square">养老服务</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="8" shape="square">生产加工</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="9" shape="square">仓储物流</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="10" shape="square">出租居住</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="11" shape="square">商务办公</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="12" shape="square">农贸市场</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="13" shape="square">宗教场所</van-checkbox>
                     <van-checkbox style="margin-bottom: 10px" name="14" shape="square">其他</van-checkbox>
                   </van-checkbox-group>
                 </template>
               </van-field>
               <van-field
                 :disabled="!isAdd"
                 v-if="showjtfwyt"
                 v-model="formData.jtfwytnr"
                 placeholder="具体用途其他内容"
                 label="具体用途其他内容"
               />
               <div>
                 <van-field
                   required
                   :disabled="!isAdd"
                   v-model="formData.jtfwytxydm"
                   placeholder="统一社会信用代码证号"
                   label="统一社会信用代码证号"
                 />
                 <!--<span class="btn-style1">-->
                   <!--证号核验-->
                 <!--</span>-->
               </div>
               <van-field
                 :disabled="!isAdd"
                 v-model="formData.qtfwytxkz"
                 placeholder="其他经营许可证号"
                 label="其他经营许可证号"
               />
             </div>
             <van-field  :disabled="!isAdd" required readonly clickable name="picker"  :value="formData.jglx | inUseName(selectData.columnsJGLX)" label="结构类型" placeholder="请选择"
                        @click="isAdd?selectData.showPickerJGLX = true:''" />
             <van-popup  v-model="selectData.showPickerJGLX" position="bottom" get-container="#popup">
               <van-picker value-key="DICNAME" show-toolbar :columns="selectData.columnsJGLX" @confirm="onConfirmJGLX"
                           @cancel="selectData.showPickerJGLX = false" />
             </van-popup>
             <van-field  :disabled="!isAdd" required v-if="formData.jglx=='1'" readonly clickable name="picker"  :value="formData.jtjglx | inUseName(selectData.columnsJTJG)" label="具体结构" placeholder="请选择"
                        @click="isAdd?selectData.showPickerJTJG = true:''" />
             <van-popup v-model="selectData.showPickerJTJG" position="bottom" get-container="#popup">
               <van-picker value-key="DICNAME" show-toolbar :columns="selectData.columnsJTJG" @confirm="onConfirmJTJG"
                           @cancel="selectData.showPickerJTJG = false" />
             </van-popup>
             <van-field
               :disabled="!isAdd"
               v-if="formData.jglx=='9'"
               v-model="formData.jtjglxnr"
               placeholder="结构类型其他内容"
               label="结构类型其他内容"
             />
             <van-field  :disabled="!isAdd" required readonly clickable name="picker"  :value="formData.sfgkj | inUseName(selectData.columns)" label="是否改扩建" placeholder="请选择"
                        @click="isAdd?selectData.showPickerGKJ = true:''" />
             <van-popup v-model="selectData.showPickerGKJ" position="bottom" get-container="#popup">
               <van-picker value-key="DICNAME" show-toolbar :columns="selectData.columns" @confirm="onConfirmGKJ"
                           @cancel="selectData.showPickerGKJ = false" />
             </van-popup>
             <van-field  :disabled="!isAdd"  required v-if="formData.sfgkj==1" name="checkboxGroup" label="改扩建内容（多选）">
               <template #input>
                 <van-checkbox-group  :disabled="!isAdd" v-model="formData.gkjlx" direction="horizontal" @change="changeData">
                   <van-checkbox style="margin-bottom: 10px" name="1" shape="square">加层</van-checkbox>
                   <van-checkbox style="margin-bottom: 10px" name="2" shape="square">加夹层</van-checkbox>
                   <van-checkbox style="margin-bottom: 10px" name="3" shape="square">加隔墙</van-checkbox>
                   <van-checkbox style="margin-bottom: 10px" name="4" shape="square">减柱</van-checkbox>
                   <van-checkbox style="margin-bottom: 10px" name="5" shape="square">减隔墙</van-checkbox>
                   <van-checkbox style="margin-bottom: 10px" name="6" shape="square">建筑外扩</van-checkbox>
                   <van-checkbox style="margin-bottom: 10px" name="7" shape="square">其他</van-checkbox>
                 </van-checkbox-group>
               </template>
             </van-field>
             <van-field
               :disabled="!isAdd"
               v-if="showData && formData.sfgkj==1 "
               v-model="formData.gkjnr"
               placeholder="改扩建其他内容"
               label="改扩建其他内容"
             />
           </div>
        </div>
        <div v-if="nowIndex===1" class="content">
          <p style="text-align: center;font-weight: bold;margin-bottom: 10px">城乡居民自建房安全专项整治核查表</p>
          <van-field
            required
            v-model="formDataPC.checkUser"
            placeholder="请输入抽查人"
            label="抽查人"
            :disabled="!isAdd"
          />
          <van-field
            required
            :disabled="!isAdd"
            v-model="formDataPC.checkPhone"
            placeholder="请输入抽查人电话"
            label="抽查人电话"
          />
          <van-field
            required
          readonly
          clickable
            :disabled="!isAdd"
          name="datetime"
          :value="formDataPC.checkTime"
          label="抽查时间："
          placeholder="请选择抽查时间"
          @click="isAdd?selectData.showPickerq = true:''"
          />
          <van-popup v-model="selectData.showPickerq" position="bottom">
          <van-datetime-picker  v-model="selectData.currentDate" type="datetime" title="选择年月日" @cancel="selectData.showPickerq = false" @confirm="onConfirmRQ" />
          </van-popup>
          <div class="list">
            <ul>
              <li
                v-for="(item, index) in contentData"
                :key="index + 'contentData'"
                :style="{
              borderBottom:
                index === contentData.length - 1 ? 'none' : '1px solid #D2D2D2',
            }"
              >
                <span style="color: red">*</span>
                <span style="color: #007aff">{{ item.name }}</span>
                <div size="mini">
                  <div
                    class="btn-style"
                    v-for="(item1, index1) in item.children"
                    :key="index1 + 'children'"
                    :style="{
                  borderBottom:
                    item.children.length - 1 === index1 ? 'none' : '',
                }"
                    :label="item1.name"
                  >
                <span v-if="item1.type == 'select'" style="padding-top: 10px">
                  <van-field

                    style="padding: 10px 0"
                    readonly
                    :required="item1.required"
                    clickable
                    name="picker"
                    :value="formDataPC[item1.key] | inUseName(item1.ARR)"
                    :label="item1.name"
                    placeholder="请选择"
                    @click="
                     item1.name !== '安全隐患初判'
                        ? isAdd
                          ? (item1.active = true)
                          : ''
                        : ''
                    "
                  />
                  <van-popup v-model="item1.active" position="bottom" get-container="#popup">
                    <van-picker
                      :required="item1.required"
                      value-key="DICNAME"
                      show-toolbar
                      :columns="item1.ARR"
                      @confirm="onConfirmContent"
                      @cancel="item1.active = false"
                    />
                  </van-popup>
                </span>
                <span v-else-if="item1.type == 'text'" style="font-size: 14px">
                </span>

                  <span v-else-if="item1.type == 'Checkbox'">
                     <p v-if="item.name=='抽查结果'" style="font-size: 14px">与房屋建筑和市政设施调查系统符合情况：</p>
                    <van-radio-group
                    v-model="formDataPC[item1.key]"
                    direction="horizontal"
                    @change="radioChange"
                    :disabled="!isAdd "
                  >
                    <van-radio
                      style="margin-bottom: 5px; font-size: 14px"
                      v-for="(item2, index2) in item1.children"
                      :key="index2 + 'childrens'"
                      :name="item2.value"
                    >{{ item2.name }}
                    </van-radio>
                  </van-radio-group>
                    <span v-if="item.name=='初步判定' && formDataPC.checkFirstResult=='1'" style="font-size: 14px">当房屋无以上情况且处于正常使用情况下或已鉴定为 A、B级。</span>
                    <span v-if="item.name=='初步判定' && formDataPC.checkFirstResult=='2'" style="font-size: 14px">
                      当存在以上一条或多条状况时，初判存在危险，房屋应进行鉴定，并根据鉴定结论分类处置
                    </span>
                    <span v-if="item.name=='初步判定' && formDataPC.checkFirstResult=='3'" style="font-size: 14px">
                     明显存在倒塌危险
                    </span>

                  </span>
                 <span v-else-if="item1.type == 'input'">
                  <van-field
                    :required="item1.required"
                    :readonly="!isAdd"
                    v-model="formDataPC[item1.key]"
                    :placeholder="item1.placeholder"
                    :label="item1.name"
                  />
                </span>
                 <span v-else>
                  <span
                    style="
                      width: 60%;
                      display: inline-block;
                      line-height: initial;
                      font-size: 14px;
                    "
                  >{{ item1.name }}</span
                  >
                  <span style="float: right; padding-top: 10px">
                    <van-radio-group

                      v-model="formDataPC[item1.key]"
                      @change="radioChangef(item1, item)"
                      direction="horizontal"
                      :disabled=" !isAdd "
                    >
                      <van-radio
                        name="0"
                        @click="radioClick(item1, item)"
                      >是</van-radio
                      >
                      <van-radio
                        name="1"
                        @click="radioClick(item1, item)"
                      >否</van-radio
                      >
                    </van-radio-group>
                  </span>
                  <span
                    v-for="(item3, index3) in item1.fileData"
                    :key="index3 + 'fileData3'"
                  >
                    <van-uploader
                      :disabled="!isAdd"
                      @click-upload="getList(item3)"
                      :after-read="afterRead"
                      :before-delete="delectFile"
                      v-model="item3.fileList"
                      accept=".jpg,.gif,.png,.jpeg"
                      multiple
                    />
                  </span>
                </span>
                  </div>
                  <div
                    v-for="(item2, index2) in item.fileData"
                    :key="index2 + 'fileData'"
                  >
                    <p style="font-size: 14px">
                  <!--<span v-if="item2.name == '房屋整体照片'" style="color: red">*</span>-->
                      {{ item2.name }}
                    </p>
                    <van-uploader
                      :disabled="!isAdd"
                      @click-upload="getList(item2)"
                      :after-read="afterRead"
                      :before-delete="delectFile"
                      v-model="item2.fileList"
                      accept=".jpg,.gif,.png,.jpeg"
                      multiple
                    />
                  </div>
                </div>
              </li>
            </ul>
          </div>
        </div>
        <div class="footer" v-if="nowIndex===1&&ISShow">
          <van-button :disabled="saveStatus" style="width: 24vw;"  size="small" type="info" @click="deleteData">删除</van-button>
          <!-- <van-button  :disabled="saveStatus"  size="small" type="info" @click="SaveData">保存</van-button> -->
          <van-button  style="width: 24vw;"  size="small" type="info" @click="editData">编辑</van-button>
          <van-button  style="width: 24vw;"  size="small" type="info" @click="updateData">提交</van-button>
      </div>
    </div>
</template>

<script>
  import {
    FileServerProxy,
    houseCheckFwCheckDetails,
    FwsaveOrUpdate,
    FwsaveOrDelete,
    uploadFile,
    deleteFile,
    selectListFile,
    getPoliceData,
    getTeshuInfo,
    getZongJiaoInfo
  } from "../../utils/api";
  import { Dialog } from 'vant';
  export default {
    name: "HousingSecurity",
    filters: {
      inUseName: function(msg, data) {
        let name = "";
        data.forEach((item) => {
          if (item.DICID == msg) {
            name = item.DICNAME;
          }
        });
        return name;
      },
    },
    data(){
      return{
        ishz: false,
        isyezz: false,
        saveStatus:false,
        ISShow:true,
        UploadFileId:[],
        cityName: '',
        JZJG: [
          {
            name: "砖砌墙",
            DICID: "0",
            children: [
              {
                name: "无异常",
                key: "liveBrickIsError",
                value: "1",
              },
              {
                name: "墙体普遍开裂，剥蚀严重",
                key: "liveBrickIsAge",
                value: "1",
              },
              {
                name: "纵横墙体交接处竖向开裂",
                key: "liveBrickIsCrack",
                value: "1",
              },
              {
                name: "墙体有歪斜",
                key: "liveBrickIsAngle",
                value: "1",
              },
              {
                name: "局部倒塌或有倒塌危险",
                key: "liveBrickIsSubside",
                value: "1",
              },
              {
                name: "使用小型混凝土空心砌块",
                key: "liveBrickIsAirBrick",
                value: "1",
              },
              {
                name: "受潮渗漏",
                key: "liveBrickIsLeak",
                value: "1",
              },
            ],
          },
          {
            name: "石砌墙",
            DICID: "1",
            children: [
              {
                name: "无异常",
                key: "liveStoneIsError",
                value: "1",
              },
              {
                name: "墙体普遍开裂或开裂严重，明显空鼓，部分石料松动",
                key: "liveStoneIsCrack",
                value: "1",
              },
              {
                name: "纵横墙体交接处竖向开裂，墙体有歪斜",
                key: "liveStoneIsAngle",
                value: "1",
              },
              {
                name: "局部倒塌或有倒塌危险",
                key: "liveStoneIsSubside",
                value: "1",
              },
              {
                name: "墙体采用乱毛石、鹅卵石砌筑，或砌筑砂浆为泥浆或无浆干砌的",
                key: "liveStoneIsBad",
                value: "1",
              },
            ],
          },
          {
            name: "生土墙体",
            DICID: "2",
            children: [
              {
                name: "无异常",
                key: "liveSoilIsError",
                value: "1",
              },
              {
                name: "墙体开裂严重",
                key: "liveSoilIsCrack",
                value: "1",
              },
              {
                name: "墙面明显剥蚀、空鼓严重",
                key: "liveSoilIsAge",
                value: "1",
              },
              {
                name: "纵横墙体交接处竖向开裂",
                key: "liveSoilIsVerticalCrack",
                value: "1",
              },
              {
                name: "墙体有歪斜",
                key: "liveSoilIsAngle",
                value: "1",
              },
              {
                name: "局部倒塌或有倒塌危险",
                key: "liveSoilIsSubside",
                value: "1",
              },
              {
                name: "处于长期受潮状态或周边排水不畅的生土墙体",
                key: "liveSoilIsLeak",
                value: "1",
              },
            ],
          },
          {
            name: "承重木构架",
            DICID: "3",
            children: [
              {
                name: "无异常",
                key: "liveWoodIsError",
                value: "1",
              },
              {
                name: "明显腐朽或虫蛀",
                key: "liveWoodIsAge",
                value: "1",
              },
              {
                name: "梁、檩跨中明显变形或出现横向裂缝",
                key: "liveWoodIsCrack",
                value: "1",
              },
              {
                name: "梁、檩端部出现劈裂",
                key: "liveWoodIsRip",
                value: "1",
              },
              {
                name: "柱身明显歪斜",
                key: "liveWoodIsAngle",
                value: "1",
              },
              {
                name: "木柱与柱基础之间错位",
                key: "liveWoodIsSubside",
                value: "1",
              },
              {
                name: "构件纵向有明显干缩裂缝",
                key: "liveWoodIsAirDried",
                value: "1",
              },
              {
                name: "卯榫节点有破损或有拔榫迹象",
                key: "liveWoodIsPool",
                value: "1",
              },
              {
                name: "承重柱存在接柱或转换情况且未采取可靠连接措施",
                key: "liveWoodIsLink",
                value: "1",
              },
            ],
          },
          {
            name: "梁柱混凝土构件",
            DICID: "4",
            children: [
              {
                name: "无异常",
                key: "liveBetonIsError",
                value: "1",
              },
              {
                name: "保护层剥落严重",
                key: "liveBoardIsAge",
                value: "1",
              },
              {
                name: "钢筋露筋、锈蚀，出现明显锈胀裂缝",
                key: "liveBoardIsCrack",
                value: "1",
              },
              {
                name: "梁柱出现明显受力裂缝和变形",
                key: "liveBoardIsAngle",
                value: "1",
              },
            ],
          },
          {
            name: "楼板混凝土构件",
            DICID: "5",
            children: [
              {
                name: "无异常",
                key: "liveBetonIsError",
                value: "1",
              },
              {
                name: "保护层剥落严重",
                key: "liveBoardIsAge",
                value: "1",
              },
              {
                name: "钢筋露筋、锈蚀，出现明显锈胀裂缝",
                key: "liveBetonIsCrack",
                value: "1",
              },
              {
                name: "楼板出现明显受力裂缝和变形。",
                key: "liveBetonIsAngle",
                value: "1",
              },
            ],
          },
          // {
            // name: "其他情况",
            // DICID: "6",
            // children: [
            //   {
            //     name: "其他存在危险性的情况",
            //     type: "input",
            //     key: "liveOtherQuestion",
            //     value: "1",
            //     required: true,
            //   },
            // ],
          // },
        ],
        showData: false,
        isAdd: false,
        formDataPC: {
          baseHousePicture: '',
          houseRadio: '',
          baseIsAge: '',
          baseIsAngle: '',
          baseIsCrack: '',
          baseIsCrackContinue: '',
          baseIsError: '',
          baseIsSubside: '',
          buildIsAddfloor: '',
          buildIsBillboard: '',
          buildIsDanger: '',
          buildIsError: '',
          buildIsRoadwork: '',
          buildIsStructure: '',
          buildIsWater: '',
          checkFirstResult: '',
          checkPhone: '',
          checkTime: '',
          checkUser: '',
          checkVertifyResult: '',
          fwid: '',
          houseIsAge: '',
          houseIsCrack: '',
          houseIsError: '',
          houseIsLeak: '',
          houseIsTransform: '',
          houseType: '',
          isCheck: '',
          liveBetonIsAge: '',
          liveBetonIsAngle: '',
          liveBetonIsCrack: '',
          liveBetonIsError: '',
          liveBoardIsAge: '',
          liveBoardIsAngle: '',
          liveBoardIsCrack: '',
          liveBoardIsError: '',
          liveBrickIsAge: '',
          liveBrickIsAirBrick: '',
          liveBrickIsAngle: '',
          liveBrickIsCrack: '',
          liveBrickIsError: '',
          liveBrickIsLeak: '',
          liveBrickIsSubside: '',
          liveOtherIsError: '',
          // liveOtherQuestion: '',
          liveSoilIsAge: '',
          liveSoilIsAngle: '',
          liveSoilIsCrack: '',
          liveSoilIsError: '',
          liveSoilIsLeak: '',
          liveSoilIsSubside: '',
          liveSoilIsVerticalCrack: '',
          liveStoneIsAngle: '',
          liveStoneIsBad: '',
          liveStoneIsCrack: '',
          liveStoneIsError: '',
          liveStoneIsSubside: '',
          liveStructerType: '',
          liveWoodIsAge: '',
          liveWoodIsAirDried: '',
          liveWoodIsAngle: '',
          liveWoodIsCrack: '',
          liveWoodIsError: '',
          liveWoodIsLink: '',
          liveWoodIsPool: '',
          liveWoodIsRip: '',
          liveWoodIsSubside: '',
        },
        contentData: [
          {
            name: "建筑周边环境",
            children: [
              {
                name: "无异常",
                key: "buildIsError",
                value: "",
              },
              {
                name: "房屋周边地面长期积水",
                key: "buildIsWater",
                value: "",
              },
              {
                name: "房屋上装有大型广告牌",
                key: "buildIsBillboard",
                value: "",
              },
              {
                name: "房屋周边有工程建设和深基坑 施工情况",
                key: "buildIsRoadwork",
                value: "",
              },
              {
                name: "房屋周边有影响安全的危险因素(例如山体滑坡等)",
                key: "buildIsDanger",
                value: "",
              },
              {
                name: '是否有未经设计擅自加层的情况',
                key: 'buildIsAddfloor',
                value: ''
              },
              {
                name: "有破墙开门、开窗或开店等影响结构安全的行为，或其他改变使用功能有较大变动情况",
                key: "buildIsStructure",
                value: "",
              },
            ],
          },
          {
            name: "地基基础",
            children: [
              {
                name: "无异常",
                key: "baseIsError",
                value: "1",
              },
              {
                name: "房屋出现明显不均匀沉降（斜向） 裂缝",
                key: "baseIsCrack",
                value: "1",
              },

              {
                name: "外露基础明显腐蚀、酥碱、松散 和剥落",
                key: "baseIsAge",
                value: "1",
              },
              {
                name: "裂缝持续发展尚未稳定",
                key: "baseIsCrackContinue",
                value: "1",
              },
              {
                name: "出现明显倾斜",
                key: "baseIsAngle",
                value: "1",
              },
              {
                name: "基础局部或整体塌陷",
                key: "baseIsSubside",
                value: "1",
              },
            ],
            fileData: [
              {
                name: "房屋整体照片",
                groupGuid: "3",
                fileList: [],
              },
            ],
          },
          {
            name: "楼屋面",
            children: [
              {
                // name: '类型',
                type: "Checkbox",
                key: 'houseRadio',
                children: [
                  {
                    name: "无异常",
                    value: "1",
                    key: "houseIsError",
                  },
                  {
                    name: "明显变形",
                    value: "2",
                    key: "houseIsTransform",
                  },
                  {
                    name: "明显裂缝",
                    value: "3",
                    key: "houseIsCrack",
                  },
                  {
                    name: "较严重渗漏",
                    value: "4",
                    key: "houseIsLeak",
                  },
                  {
                    name: "老化破损",
                    value: "5",
                    key: "houseIsAge",
                  },
                ],
                disabled: false
              },
            ],
          },
          {
            name: "现场检查",
            disabled: false,
            children: [
              {
                name: "建筑结构",
                type: "select",
                key: "liveStructerType",
                active: false,
                value: "",
                ARR: [
                  {
                    DICNAME: "砖砌墙",
                    DICID: "0",
                  },
                  {
                    DICNAME: "石砌墙",
                    DICID: "1",
                  },
                  {
                    DICNAME: "生土墙体",
                    DICID: "2",
                  },
                  {
                    DICNAME: "承重木构架",
                    DICID: "3",
                  },
                  {
                    DICNAME: "梁柱混凝土构件",
                    DICID: "4",
                  },
                  {
                    DICNAME: "楼板混凝土构件",
                    DICID: "5",
                  },
                  // {
                  //   DICNAME: "其他情况",
                  //   DICID: "6",
                  // },
                ],
              },
              {
                name: "无异常",
                key: "liveBrickIsError",
                value: "1",
              },
              {
                name: "墙体普遍开裂，剥蚀严重",
                key: "liveBrickIsAge",
                value: "1",
              },
              {
                name: "纵横墙体交接处竖向开裂",
                key: "liveBrickIsCrack",
                value: "1",
              },
              {
                name: "墙体有歪斜",
                key: "liveBrickIsAngle",
                value: "1",
              },
              {
                name: "局部倒塌或有倒塌危险",
                key: "liveBrickIsSubside",
                value: "1",
              },
              {
                name: "使用小型混凝土空心砌块",
                key: "liveBrickIsAirBrick",
                value: "1",
              },
              {
                name: "受潮渗漏",
                key: "liveBrickIsLeak",
                value: "1",
              },
            ],
          },
          {
            name: "初步判定",
            children: [
              {
                type: "Checkbox",
                key: 'checkFirstResult',
                children: [
                  {
                    name: "房屋基本安全",
                    value: '1',
                    key: "house_is_error",
                  },
                  {
                    name: "潜在危险房屋",
                    value: '2',
                    key: "house_is_transform",
                  },
                  {
                    name: "危险房屋",
                    value: '3',
                    key: "house_is_crack",
                  },
                ],
                disabled: false
              },
            ],
          },
          {
            name: "抽查结果",
            children: [
              {
                type: "Checkbox",
                key: 'checkVertifyResult',
                children: [
                  {
                    name: "相符",
                    value: '0',
                    key: "house_is_error",
                  },
                  {
                    name: "基本相符",
                    value: '1',
                    key: "house_is_transform",
                  },
                  {
                    name: "不相符",
                    value: '2',
                    key: "house_is_crack",
                  },
                ],
                disabled: false
              },
            ],
          },
        ],
        nowIndex: 0,
        tabArr: ["基本情况", "现场状况"],
        selectData: {
          showPickerq: false,
          currentDate: new Date(),
          showPicker: false,
          columns: [
            {
              DICNAME: '是',
              DICID: '1'
            },
            {
              DICNAME: '否',
              DICID: '2'
            }
          ],
          showPickerFWLX: false,
          FWLXArr: [
            {
              DICNAME: '自建房',
              DICID: '1'
            },
            {
              DICNAME: '非自建房',
              DICID: '2'
            }
          ],
          showPickerFWYT: false,
          FWYTArr: [
            {
              DICNAME: '经营性自建房',
              DICID: '6'
            },
            {
              DICNAME: '其他自建房',
              DICID: '7'
            }
          ],
          showPickerIFTSZZ: false,
          showPickerJGLX: false,
          columnsJGLX: [
            {
              DICNAME: '砌体结构',
              DICID: '1'
            },
            {
              DICNAME: '底部框架-上部砌体结构',
              DICID: '2'
            },
            {
              DICNAME: '钢筋混凝土结构',
              DICID: '3'
            },
            {
              DICNAME: '钢结构',
              DICID: '4'
            },
            {
              DICNAME: '木(竹)结构',
              DICID: '5'
            },
            {
              DICNAME: '土木/石木结构',
              DICID: '6'
            },
            {
              DICNAME: '混杂结构',
              DICID: '7'
            },
            {
              DICNAME: '窑洞',
              DICID: '8'
            },
            {
              DICNAME: '其他',
              DICID: '9'
            },
          ],
          showPickerGKJ: false,
          showPickerJTJG: false,
          columnsJTJG: [
            {
              DICNAME: '预制板',
              DICID: '1'
            },
            {
              DICNAME: '现浇板',
              DICID: '2'
            },
            {
              DICNAME: '木或轻钢楼层盖',
              DICID: '3'
            },
            {
              DICNAME: '石板或石条',
              DICID: '4'
            }
          ]
        },
        showjtfwyt:false,
        formData: {
          jtfwytnr:'',
          jtjglxnr:'',
          cqdwfr: '',
          cqdwfrzjhm: '',
          cqdwmc: '',
          cqdwxydm: '',
          cqrxm: '',
          cqrzjhm: '',
          fwyt: '',
          fwid: '',
          gkjlx: [],
          gkjnr: '',
          housetype: '',
          jglx: '',
          jtfwyt: [],
          jtfwytxydm: '',
          jtjglx: '',
          qtfwytxkz: '',
          sfgkj: '',
          sftszz: '',
          citycode: '',
        },
        isSave: false
      }
    },
    methods:{
      NumberCheck: async function() {
      let params = {
        accessCode: "a02f84a3615d11ec87416805cab640a0",
        cityCode: window.sessionStorage.getItem("citycodeCun"),
        appKey: "6738b790-69e8-11ec-a673-6805cab640a0",
        params: { entname: this.formData.cqdwmc}
      };
      const res1 = await getPoliceData(params);
      if (
        res1.data.code == "200" &&
        res1.data.data.datas &&
        JSON.parse(res1.data.data.datas).length > 0
      ) {
        this.isyezz = true;
        this.formData.cqdwxydm = JSON.parse(
          res1.data.data.datas
        )[0].ELC_LICENCE_STRUCT.DATA.UNISCID;
        this.formData.cqdwfr = JSON.parse(
          res1.data.data.datas
        )[0].ELC_LICENCE_STRUCT.DATA.NAME;
      } else {
        this.isyezz = false;
      }
      if (this.isyezz) {
        this.$toast.success("核验成功!");
      } else {
        Dialog.alert({
          title: '提示',
          message: '经与工商局大数据信息核对，您录入的企业信息不存在，请核实。',
        }).then(() => {
          // on close
        });
        // this.$toast.fail("经与工商局大数据信息核对，您录入的企业信息不存在，请核实。");
      }
    },
      onclickplice: async function() {
      var p = {
        appKey: "6738b790-69e8-11ec-a673-6805cab640a0",
        accessCode: "4f54f932615d11ec87416805cab640a0",
        cityCode: window.sessionStorage.getItem("citycodeCun"),
        params: { czrkgmsfhm: this.formData.cqrzjhm }
      };
      var resData = await getPoliceData(p);
      if (resData.data.data && resData.data.data.datas&& resData.data.data.datas.length>0) {
        resData.data.data.datas.forEach(item => {
          if (
            item.ELC_LICENCE_STRUCT.DATA.CZRKGMSFHM == this.formData.cqrzjhm && item.ELC_LICENCE_STRUCT.DATA.CZRKHZXM == this.formData.cqrxm && item.ELC_LICENCE_STRUCT.DATA.CZRKYHZGX == "户主"
          ) {
              this.ishz = true;
          }
        });
      } else {
        this.ishz = false;
      }
      this.$nextTick(()=>{
        if (this.ishz) {
          this.$toast.success("核验成功!");
        } else {
          Dialog.alert({
            title: '提示',
            message: '经与公安厅户籍大数据信息核对，您录入的人员信息不存在，请核实。',
          }).then(() => {});
          // this.$toast.fail("");
        }
      })

    },
      editData(){
        if (this.rowData){
           this.isAdd = true
        }else{

        }
      },
      radioChangef(data, event) {
        if (data.name === "无异常") {
        } else {
          let arr = [];
          for (let i in this.formDataPC) {
            if (
              i != "buildIsError" &&
              i != "baseIsError" &&
              i != "houseIsError" &&
              i != "liveIsError" &&
              i != "liveSoilIsError" &&
              i != "liveStoneIsError" &&
              i != "liveWoodIsError" &&
              i != "liveBetonIsError" &&
              i != "liveBrickIsError" &&
              i != "checkFirstResult" &&
              i != "liveStructerType" &&
              i != "checkVertifyResult" &&
              i != "isCheck"
            ) {
              if (this.formDataPC[i] == "0") {
                arr.push(this.formDataPC[i]);
              }
            }
          }
          if (arr.indexOf("0") !== -1) {
            this.contentData.forEach((item, index) => {
              if (item.name == '初步判定') {
                item.children.forEach((item1, index1) => {
                  if (item1.children.length == 3) {
                    item1.children.splice(0, 1)
                  }
                })
              }
            })
          } else {
            this.contentData.forEach((item, index) => {
              if (item.name == '初步判定') {
                item.children.forEach((item1, index1) => {
                  if (item1.children.length == 2) {
                    item1.children.unshift(
                      {
                        name: "房屋基本安全",
                        value: '1',
                        key: "house_is_error",
                      }
                    )
                  }
                })
              }
            })
          }
        }
      },
      radioClick(data, event) {
        if (data.name === "无异常") {
          if (this.formDataPC[data.key] == "0") {
            this.contentData.forEach((item, index) => {
              if (item.name == event.name) {
                item.children.forEach((item1, index) => {
                  if (item1.key !== data.key) {
                    if (item1.key !== 'liveStructerType') {
                      this.formDataPC[item1.key] = "1";
                    }
                  }
                });
              }
            });
          } else {
            this.contentData.forEach((item, index) => {
              if (item.name == event.name) {
                item.children.forEach((item1, index) => {
                  if (item1.key !== data.key) {
                    if (item1.key !== 'liveStructerType') {
                      this.formDataPC[item1.key] = "2";
                    }
                  }
                });
              }
            });
          }
        } else {
        }
      },
      getData: async function(data) {
        const res = await houseCheckFwCheckDetails(data);
        console.log(res);
        let FwCheckData = res.data.data
        if (FwCheckData) {
          for (let i in this.formData) {
            if (i !== 'gkjlx' && i !== 'jtfwyt') {
              if (FwCheckData.houseCheckBaseInfo[i]){
                this.formData[i] = FwCheckData.houseCheckBaseInfo[i]
              }

            } else {
              if (FwCheckData.houseCheckBaseInfo[i]){
                this.formData[i] = FwCheckData.houseCheckBaseInfo[i].split(',')
              }

            }
          }
          for (let i in this.formDataPC) {
            if (FwCheckData.houseCheckInfo[i] !== undefined && FwCheckData.houseCheckInfo[i] !== null) {
              this.formDataPC[i] = typeof (FwCheckData.houseCheckInfo[i]) == 'number' ? FwCheckData.houseCheckInfo[i].toString() : FwCheckData.houseCheckInfo[i]
            }
          }

          if (FwCheckData.houseCheckInfo.houseIsError == 0) {
            this.formDataPC.houseRadio = "1";
          } else if (FwCheckData.houseCheckInfo.houseIsTransform == 0) {
            this.formDataPC.houseRadio = "2";
          } else if (FwCheckData.houseCheckInfo.houseIsCrack == 0) {
            this.formDataPC.houseRadio = "3";
          } else if (FwCheckData.houseCheckInfo.houseIsLeak == 0) {
            this.formDataPC.houseRadio = "4";
          } else if (FwCheckData.houseCheckInfo.houseIsAge == 0) {
            this.formDataPC.houseRadio = "5";
          }
          this.contentData.forEach((item, index) => {
            item.children.forEach((item1, index1) => {
              if (item1.name === "建筑结构") {
                item.children.splice(1, item.children.length - 1);
                this.JZJG.forEach((item2, index2) => {
                  if (item2.DICID == FwCheckData.houseCheckInfo.liveStructerType) {
                    item2.children.forEach((item3) => {
                      item.children.push(item3);
                    });
                  }
                });
              }
            });
          });
          console.log(this.formDataPC)

          if (this.formData.jtfwyt.indexOf("14") != -1) {
            this.showjtfwyt = true
          } else {
            this.showjtfwyt = false
          }
          if (this.formData.gkjlx.indexOf("7") != -1) {
            this.showData = true
          } else {
            this.showData = false
          }
          this.getFile()
        }
      },
      updateData: async function() {
        this.isSave = true
        if (this.formData.housetype=="1"){
          let p = {
            appKey: "6738b790-69e8-11ec-a673-6805cab640a0",
            accessCode: "4f54f932615d11ec87416805cab640a0",
            cityCode: window.sessionStorage.getItem("citycodeCun"),
            params: { czrkgmsfhm: this.formData.cqrzjhm }
          };
          let resData = await getPoliceData(p);
          if (resData.data.data && resData.data.data.datas&& resData.data.data.datas.length>0) {
            resData.data.data.datas.forEach(item => {
              if (
                item.ELC_LICENCE_STRUCT.DATA.CZRKGMSFHM == this.formData.cqrzjhm && item.ELC_LICENCE_STRUCT.DATA.CZRKHZXM == this.formData.cqrxm && item.ELC_LICENCE_STRUCT.DATA.CZRKYHZGX == "户主"
              ) {
                // if (item.ELC_LICENCE_STRUCT.DATA.CZRKYHZGX == "户主") {
                  this.ishz = true;
                // } else {
                //   this.ishz = false;
                // }
              }
            });
            this.$nextTick(()=>{
              if (this.ishz) {
                this.saveUpdateData()
              } else {
                Dialog.alert({
                  title: '提示',
                  message: '经与公安厅户籍大数据信息核对，您录入的人员信息不存在，请核实。',
                }).then(() => {
                  // on close
                });
              }
            })
          } else {
            Dialog.alert({
              title: '提示',
              message: '经与公安厅户籍大数据信息核对，您录入的人员信息不存在，请核实。',
            }).then(() => {
              // on close
            });
          }
        }else{
          let params = {
            accessCode: "a02f84a3615d11ec87416805cab640a0",
            cityCode: window.sessionStorage.getItem("citycodeCun"),
            appKey: "6738b790-69e8-11ec-a673-6805cab640a0",
            params: { entname: this.formData.cqdwmc}
          };
          const res1 = await getPoliceData(params);
          if (
            res1.data.code == "200" &&
            res1.data.data.datas &&
            JSON.parse(res1.data.data.datas).length > 0
          ) {
            this.isyezz = true;
            if (JSON.parse(res1.data.data.datas)[0]){
              if (JSON.parse(res1.data.data.datas)[0].ELC_LICENCE_STRUCT.DATA.UNISCID == this.formData.cqdwxydm){
                this.saveUpdateData()
              }else{
                Dialog.alert({
                  title: '提示',
                  message: '经与工商局大数据信息核对，您录入的企业信息不存在，请核实。',
                }).then(() => {
                });
              }
              // UNISCID
            }
            // console.log(JSON.parse(res1.data.data.datas))
            //
          } else {
            this.isyezz = false;
            Dialog.alert({
              title: '提示',
              message: '经与工商局大数据信息核对，您录入的企业信息不存在，请核实。',
            }).then(() => {
              // on close
            });
          }
        }
        this.saveUpdateData()
      },
      // getZongJiaoInfo
      saveUpdateData: async function(){
        console.log(this.formData.jtfwyt)
        if (this.formData.jtfwyt){
          this.formData.jtfwyt.forEach(async item =>{
            if (item =="2"){
              let params = {
                  "appKey":"6738b790-69e8-11ec-a673-6805cab640a0",
                  "accessCode":"",
                  "creditCode":this.formData.jtfwytxydm
              }
              const res1 = await getTeshuInfo(params);
              if (res1.data.data.length>0){
                this.saveUpdates()
              }else{
                Dialog.alert({
                     title: '提示',
                     message: '经与特殊行业大数据信息核对，您录入的信息不存在，请核实。',
                  }).then(() => {});
              }
            }else if (item=='13') {
              let params = {
                "appKey":"6738b790-69e8-11ec-a673-6805cab640a0",
                "accessCode":"",
                "creditCode":this.formData.jtfwytxydm
              }
              const res1 = await getZongJiaoInfo(params);
              if (res1.data.data.length>0){
                this.saveUpdates()
              }else{
                Dialog.alert({
                  title: '提示',
                  message: '经与宗教大数据信息核对，您录入的信息不存在，请核实。',
                }).then(() => {});
              }
            }
          })
        }
      },
      saveUpdates: async function(){
        let formBT = true;
        if (this.formData.housetype && this.formData.fwyt && this.formData.jglx && this.formData.sfgkj) {
          if (this.formData.housetype == 1) {
            if (!this.formData.cqrxm || !this.formData.cqrzjhm) {
              formBT = false
            }
          }
          if (this.formData.housetype == 2) {
            if (!this.formData.cqdwmc || !this.formData.cqdwxydm || !this.formData.cqdwfr || !this.formData.cqdwfrzjhm) {
              formBT = false
            }
          }
          if (this.formData.fwyt == 1) {
            if (!this.formData.sftszz || !this.formData.jtfwytxydm || this.formData.jtfwyt.length == 0) {
              formBT = false
            }
          }
          if (this.formData.jglx == 1 && !this.formData.jtjglx) {
            formBT = false
          }
          if (this.formData.sfgkj == 1) {
            if (this.formData.gkjlx.length == 0) {
              formBT = false
            } else if (this.formData.gkjlx.indexOf('7') != -1 && !this.formData.gkjnr) {
              formBT = false
            }
          }
        } else {
          formBT = false
        }
        this.contentData.forEach(item => {
          let arr = []
          if (item.children) {
            item.children.forEach(items => {
              console.log(this.formDataPC[items.key])
              if (items.type == "select" && !this.formDataPC[items.key]) {
                formBT = false
              } else if (items.type == "Checkbox" && this.formDataPC[items.key].length == 0) {
                formBT = false
              } else if (items.type != "select" && this.formDataPC[items.key] === "0") {
                arr.push(items.key)
              }
            })
          }
          if (item.fileData) {
            item.fileData.forEach((items, index) => {
              if (items.fileList.length == 0) {
                formBT = false;
              }
            });
          }
          if (item.name == '建筑周边环境' || item.name == '地基基础' || item.name == '现场检查') {
            if (arr.length == 0) {
              formBT = false
            }
          }

        })
        if (formBT) {
          this.formData.citycode = window.sessionStorage.getItem('citycodeCun')
          console.log(typeof this.formData.gkjlx)
          // if (typeof this.formData.gkjlx == 'object'){
          //   this.formData.gkjlx = this.formData.gkjlx.join(",")
          //   this.formData.jtfwyt = this.formData.jtfwyt.join(",")
          // }

          this.formData.sjlx = window.sessionStorage.getItem('citycodeRole')
          this.formDataPC.isCheck = "1"
          this.formDataPC.baseHousePicture = this.UploadFileId.join(',')

          delete this.formData.houseRadio
          let params = {
            // 基本情况
            houseCheckBaseInfo: this.formData,
            // 现场状况
            houseCheckInfo: this.formDataPC,
          };
          console.log(params)
          if (typeof params.houseCheckBaseInfo.gkjlx == 'object'){
            params.houseCheckBaseInfo.gkjlx = params.houseCheckBaseInfo.gkjlx.join(",")
            params.houseCheckBaseInfo.jtfwyt = params.houseCheckBaseInfo.jtfwyt.join(",")
          }
          const res1 = await FwsaveOrUpdate(params);
          console.log(res1)
          if (res1.data.code == 200) {
            this.$toast.success("提交成功!");
            this.saveStatus = true
          } else {
            this.$toast.fail("提交失败!");
          }
        } else {
          this.$toast.fail("请输入必填项并上传房屋整体照片!");
        }
      },
      // 保存
      SaveData: async function() {
        this.isSave = true
        // let formBT = true;
        // if(this.formData.housetype&&this.formData.fwyt&&this.formData.jglx&&this.formData.sfgkj){
        //   if(this.formData.housetype == 1){
        //     if(!this.formData.cqrxm||!this.formData.cqrzjhm){
        //       formBT = false
        //     }
        //   }
        //   if(this.formData.housetype == 2){
        //     if(!this.formData.cqdwmc||!this.formData.cqdwxydm||!this.formData.cqdwfr||!this.formData.cqdwfrzjhm){
        //       formBT = false
        //     }
        //   }
        //   if(this.formData.fwyt == 1){
        //     if(!this.formData.sftszz||!this.formData.jtfwytxydm||this.formData.jtfwyt.length==0){
        //       formBT = false
        //     }
        //   }
        //   if(this.formData.jglx == 1&&!this.formData.jtjglx){
        //     formBT = false
        //   }
        //   if(this.formData.sfgkj == 1){
        //     if(this.formData.gkjlx.length==0){
        //       formBT = false
        //     }else if(this.formData.gkjlx.indexOf('7')!=-1&&!this.formData.gkjnr){
        //       formBT = false
        //     }
        //   }
        // }else{
        //   formBT = false
        // }
        // this.contentData.forEach(item=>{
        //   let arr = []
        //   if(item.children){
        //     item.children.forEach(items=>{
        //       if(items.type == "select" && !this.formDataPC[items.key]){
        //         formBT = false
        //       }else if(items.type == "Checkbox"&&this.formDataPC[items.key].length == 0){
        //         formBT = false
        //       }else if(items.type != "select" && this.formDataPC[items.key] === "0"){
        //         arr.push(items.key)
        //       }
        //     })
        //   }
        //   if (item.fileData) {
        //     item.fileData.forEach((items, index) => {
        //       if ( items.fileList.length == 0) {
        //         formBT = false;
        //       }
        //     });
        //   }
        //   if(item.name == '建筑周边环境'||item.name == '地基基础'||item.name == '现场检查'){
        //     if(arr.length == 0 ){
        //       formBT = false
        //     }
        //   }
        //
        // })
        // if(formBT){
        console.log(typeof this.formData.gkjlx)
        this.formData.citycode = window.sessionStorage.getItem('citycodeCun')
        // if (typeof this.formData.gkjlx == 'object'){
        //   this.formData.gkjlx = this.formData.gkjlx.join(",")
        //   this.formData.jtfwyt = this.formData.jtfwyt.join(",")
        // }
        this.formData.sjlx = window.sessionStorage.getItem('citycodeRole')
        this.formDataPC.isCheck = "0"
        this.formDataPC.baseHousePicture = this.UploadFileId.join(',')
        delete this.formData.houseRadio
        let params = {
          // 基本情况
          houseCheckBaseInfo: this.formData,
          // 现场状况
          houseCheckInfo: this.formDataPC,
        };
        if (typeof params.houseCheckBaseInfo.gkjlx == 'object'){
          params.houseCheckBaseInfo.gkjlx = params.houseCheckBaseInfo.gkjlx.join(",")
          params.houseCheckBaseInfo.jtfwyt = params.houseCheckBaseInfo.jtfwyt.join(",")
        }
        const res1 = await FwsaveOrUpdate(params);
        if (res1.data.code == 200) {
          this.$toast.success("保存成功!");
        } else {
          this.$toast.fail("保存失败!");
        }
      },
    radioChange(data) {
      switch (this.formDataPC.houseRadio) {
        case "1":
          this.formDataPC.houseIsError = "0";
          this.formDataPC.houseIsTransform = "1";
          this.formDataPC.houseIsLeak = "1";
          this.formDataPC.houseIsCrack = "1";
          this.formDataPC.houseIsAge = "1";
          break;
        case "2":
          this.formDataPC.houseIsTransform = "0";
          this.formDataPC.houseIsError = "1";
          this.formDataPC.houseIsLeak = "1";
          this.formDataPC.houseIsCrack = "1";
          this.formDataPC.houseIsAge = "1";
          break;
        case "3":
          this.formDataPC.houseIsLeak = "1";
          this.formDataPC.houseIsTransform = "1";
          this.formDataPC.houseIsError = "1";
          this.formDataPC.houseIsCrack = "0";
          this.formDataPC.houseIsAge = "1";
          break;
        case "4":
          this.formDataPC.houseIsCrack = "1";
          this.formDataPC.houseIsError = "1";
          this.formDataPC.houseIsTransform = "1";
          this.formDataPC.houseIsLeak = "0";
          this.formDataPC.houseIsAge = "1";
          break;
        case "5":
          this.formDataPC.houseIsAge = "0";
          this.formDataPC.houseIsError = "1";
          this.formDataPC.houseIsTransform = "1";
          this.formDataPC.houseIsLeak = "1";
          this.formDataPC.houseIsCrack = "1";
          break;
      }
      let arr = [];
      for (let i in this.formDataPC) {
        if (
          i != "buildIsError" &&
          i != "baseIsError" &&
          i != "houseIsError" &&
          i != "liveIsError" &&
          i != "liveSoilIsError" &&
          i != "liveStoneIsError" &&
          i != "liveWoodIsError" &&
          i != "liveBetonIsError" &&
          i != "liveBrickIsError" &&
          i != "checkFirstResult" &&
          i != "liveStructerType" &&
          i != "checkVertifyResult" &&
          i != "isCheck"
        ) {
          if (this.formDataPC[i] == "0") {
            console.log(i)
            arr.push(this.formDataPC[i]);
          }
        }
      }
      if (arr.indexOf("0") !== -1) {
        this.contentData.forEach((item, index) => {
          if (item.name == '初步判定') {
            item.children.forEach((item1, index1) => {
              if (item1.children.length == 3) {
                item1.children.splice(0, 1)
              }
            })
          }
        })
      } else {
        this.contentData.forEach((item, index) => {
          if (item.name == '初步判定') {
            item.children.forEach((item1, index1) => {
              if (item1.children.length == 2) {
                item1.children.unshift(
                  {
                    name: "房屋基本安全",
                    value: '1',
                    key: "house_is_error",
                  }
                )
              }
            })
          }
        })
      }
    },
    changeData(data) {
      if (data.indexOf("7") != -1) {
        this.showData = true
      } else {
        this.showData = false
      }
    },
    changeData1(data) {
        if (data.indexOf("14") != -1) {
          this.showjtfwyt = true
        } else {
          this.showjtfwyt = false
        }
      },
    getList(item) {
      this.groupGuids = item.groupGuid;
    },
    afterRead(file) {
        console.log(Array.isArray(file))
      if (Array.isArray(file)){
        file.forEach((item,index)=>{
          this.getFileServerUpload(item.file);
        })
      }else{
        this.getFileServerUpload(file.file);
      }
    },
    getFile: async function() {
      this.UploadFileId = []
      this.contentData[1].fileData[0].fileList = []
      let params = {
        id: this.formDataPC.baseHousePicture
      }
      const res = await selectListFile(params);
      this.fileData = res.data.data
      console.log(res.data.data)
      if (res.data.data) {
        res.data.data.forEach((item, index) => {
          console.log(item);
          // this.fileIdData.push(item.fileId)
          this.UploadFileId.push(item.fileId)
          console.log(window.g.BaseURL4+item.path+'?download=0')
          this.contentData[1].fileData[0].fileList.push(
            {
              url: window.g.BaseURL4+item.path+'?download=0',
              isImage: true,
              fileId:item.fileId
            }
          )
        })
      }
    },
    getFileServerUpload: async function(file) {
      let formData = new FormData();
      formData.append("file", file);
      formData.append("token", window.localStorage.getItem("token"));
      const res = await uploadFile(formData);
      console.log(res)
      if (res.data.data) {
        this.fileGuid = res.data.data.id
        this.UploadFileId.push(res.data.data.id)
        this.$toast.success("上传成功!");

      }
      // this.fileGuid = data1[0].FILEGUID;
    },
    delectFile: async function(file) {
        console.log(file)
      console.log(typeof file)
      let fileId = ""
      if (file.file) {
        // alert(1)
        fileId = this.fileGuid
        this.UploadFileId.pop()
      } else {
        this.fileData.forEach((item, index) => {
          if (item.fileId == file.fileId) {
            fileId = item.fileId
          }
          if (this.UploadFileId){
            this.UploadFileId.forEach((item1, index1) => {
              if (item.fileId == item1) {
                this.UploadFileId.splice(index1, 1)
              }
            })
          }

        })
      }
      let params = [fileId]
      const res = await deleteFile(params);
      console.log(res)
      if (res.data.data) {
        this.$toast.success("删除成功!");
      }
    },
    onConfirmContent(val) {
      this.DICNAME = val.DICID;
      this.contentData.forEach((item, index) => {
        item.children.forEach((item1, index1) => {
          if (item1.active) {
            this.formDataPC[item1.key] = val.DICID;
            item1.active = false;
          }
          // if (item1.type=='Checkbox'){
          //   item1.disabled = true
          //   this.$forceUpdate()
          // }
          if (item1.name === "建筑结构") {
            // if (this.formDataPC.live_structer_type){
            //   this.disabled = false
            // }
            this.JZJG.forEach((item2, index2) => {
              if (item2.name === val.DICNAME) {
                item.children.splice(1, item.children.length - 1);
                item2.children.forEach((item3) => {
                  item.children.push(item3);
                });
              }
            });
          }
        });
      });
    },
    onConfirmRQ(val) {
      let year = val.getFullYear()
      let month = val.getMonth() + 1
      let day = val.getDate()
      let hour = val.getHours()
      let minute = val.getMinutes()
      let second = val.getSeconds()
      if (month >= 1 && month <= 9) {
        month = `0${month}`
      }
      if (day >= 1 && day <= 9) {
        day = `0${day}`
      }
      if (hour >= 0 && hour <= 9) {
        hour = `0${hour}`
      }
      if (minute >= 0 && minute <= 9) {
        minute = `0${minute}`
      }
      if (second >= 0 && second <= 9) {
        second = `0${second}`
      }
      this.formDataPC.checkTime = `${year}-${month}-${day} ${hour}:${minute}:${second}`
      console.log(this.formDataPC.checkTime)
      this.selectData.showPickerq = false
    },
    onConfirm(val) {
      this.selectData.showPicker = false
    },
    onConfirmFWLX(val) {
      this.selectData.showPickerFWLX = false
      this.formData.housetype = val.DICID
    },
    onConfirmJGLX(val) {
      this.selectData.showPickerJGLX = false
      this.formData.jglx = val.DICID
    },
    onConfirmJTJG(val) {
      this.selectData.showPickerJTJG = false
      this.formData.jtjglx = val.DICID
    },
    tabClick(index) {
      this.nowIndex = index
    },
    onConfirmFWYT(val) {
      this.selectData.showPickerFWYT = false
      this.formData.fwyt = val.DICID
    },
    onConfirmIFTSZZ(val) {
      this.selectData.showPickerIFTSZZ = false
      this.formData.sftszz = val.DICID
    },
    onConfirmGKJ(val) {
      this.selectData.showPickerGKJ = false
      this.formData.sfgkj = val.DICID
    },
    deleteData: async function() {
      if (this.rowData || this.isSave) {
        const res1 = await FwsaveOrDelete(this.formDataPC.fwid);
        console.log(res1)
        if (res1.data.data) {
          this.$toast.success("删除成功!");
        }
      } else {
        // this.$toast.fail
      }

    }
    },
    components:{},
    mounted(){
      if( window.sessionStorage.getItem("citycodeRole") == "0" && window.sessionStorage.getItem("SelectCity") == "1" ||  window.sessionStorage.getItem("citycodeRole") == "0" &&
        window.sessionStorage.getItem("SelectCity") == "2"||(window.sessionStorage.getItem("citycodeRole") == "1" && window.sessionStorage.getItem("SelectCity") == "2")){
          this.ISShow = false
      }else{
        this.ISShow = true
      }
      this.onConfirmRQ(new Date())
      if (window.localStorage.getItem('userName')){
        let loginData = JSON.parse(window.sessionStorage.getItem('userName'))
        this.formDataPC.checkUser = loginData.userName
        this.formDataPC.checkPhone = loginData.phone
      }
      this.rowData = JSON.parse(this.$route.query.data)
      console.log(this.rowData)
      if (!this.rowData.isTrusted){
        this.isAdd = false
        this.getData(this.rowData.fwId)
        this.formData.fwid = this.rowData.fwId
        this.formDataPC.fwid = this.rowData.fwId
        if (this.rowData.saveStatus==0){
          this.saveStatus = false
        }else{
          this.saveStatus = true
        }
      }else{
        this.saveStatus = false
        this.isAdd = true
        this.formData.fwid =  this.newGuid()
        this.formDataPC.fwid = this.newGuid()
      }
      this.cityName = window.sessionStorage.getItem('citycodeQXName1').split("  ")
    }
  };
</script>

<style scoped lang="scss">
 #HousingSecurity{
   height: 100vh;
   overflow-y:hidden ;
   padding: 10px 0;
   .list ul li {
     min-height: 50px;
     line-height: 50px;
   }
   .btn-style1{
     width: 67px;
     height: 30px;
     background: #EFF6FF;
     border-radius: 4px;
     float: right;
     margin-top: -38px;
     display: inline-block;
     text-align: center;
     line-height: 30px;
     font-size: 14px;
     color: #007AFF;
   }
   .tab ul li{
    width: 50%;
    height: 50px;
    background: #fff;
    float: left;
    /*line-height: 50px;*/
    text-align: center;
    color: #000;
     padding-top: 10px;
  }
   .content{
     width: 100%;
     height: calc(100vh - 120px);
     overflow-y: auto;
     padding: 10px;
   }
   .footer{
     width: 100%;
     padding: 20px;
     text-align: center;
   }
   .select{
     color: #007AFF !important;
   }
 }
</style>
